<template>
	<view class="page">
		<view class="page__bd">
			<view style="height: 20rpx;"></view>
			<block v-for="(item,index) in list" :key="index">
				<view class="dis bacFFF borRad10 wid90 mar mar-top20 dis disJuB" @click="navTo('/pages/common/richtext',{id:item.id})">
					<!-- <view class="dis disAl disJuc mar-right20" style="width: 24%;">
						<image :src="aurl + item.cover" style="height: 140rpx;" class="wid100"></image>
					</view> -->
					 <!-- style="width: 75%;" -->
					<view class="dis disJuB fleDir">
						<view class="foSi28 mar-bott20 webkitLineClamp">{{item.title}}</view>
						<view style="color: #a1a1a1;">{{item.createtime}}</view>
					</view>
				</view>
				<view v-if="list.length != index+1" class="wid100 mar-top10" style="height: 1rpx ;border-bottom: 1rpx solid #f2f7f8;"></view>
			</block>
			<view style="height: 20rpx;"></view>
			<!-- 空数据 -->
			<view class="u-u-p-t-80 u-m-t-80 u-p-b-80" v-if="!list.length">
				<u-empty src="/static/empty-log.png" text="什么也没有~" icon-size="375" mode="list"></u-empty>
			</view>
			<!-- 加载更多 -->
			<view class="u-p-b-30" v-if="list.length">
				<u-loadmore :status="has_more ? status : 'nomore'" />
			</view>
		</view>
		<u-back-top :scroll-top="scrollTop"></u-back-top>
	</view>
</template>
<script>
	import {BASE_URL,HEADER} from '../../config.js'
	export default {
		data() {
			return {
				list: [],
				page: 1,
				is_update: false,
				has_more: false,
				scrollTop: 0,
				status: 'loadmore',
				aurl:BASE_URL
			}
		},
		onLoad() {
			this.getMyOrderList()
		},
		methods: {
			getMyOrderList: async function() {
				this.$u.api.news_list({
					page: this.page
				}).then(res => {
					uni.stopPullDownRefresh();
					if (res.code) {
						if (this.is_update) {
							this.list = [];
							this.is_update = false;
						}
						this.list = [...this.list, ...res.data.data];
						this.has_more = res.data.current_page < res.data.last_page;
					}
				});
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		//下拉刷新
		onPullDownRefresh() {
			this.is_update = true;
			this.page = 1;
			this.getMyOrderList();
		},
		onReachBottom() {
			if (this.has_more) {
				this.status = 'loading';
				this.page++;
				this.getMyOrderList();
			}
		}
	}
</script>

<style>
	.order-list .item {
		display: flex;
		align-items: center;
		border-bottom: 1rpx solid #eeeeee;
		padding: 30rpx 0;
	}

	.order-list .item .u-image {
		flex-shrink: 0;
		border-radius: 20rpx !important;
		overflow: hidden !important;
	}

	.order-list .item .info {
		padding-left: 20rpx;

	}

	.order-list .item .info .title {
		font-size: 32rpx;
		font-weight: 600;
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;

	}

	.order-list .item .info .bottom {
		margin-top: 20rpx;
		color: #2196F3;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.order-list .item .info .bottom .number {
		font-size: 28rpx;
		margin-right: 10rpx;
	}

	.order-list .item .info .bottom .score {
		font-weight: bold;
		font-size: 32rpx;
		color: #2196F3;
		display: flex;
		align-items: center;
	}
</style>
